using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections;
using System.Text;

namespace _18miljard.Db
{
	//each object is an ArrayList of objects
    public class ResultSetColumnCollection
    {
		Dictionary<string, ArrayList> columns = new Dictionary<string, ArrayList>();
		StringCollection names = new StringCollection();

		internal void Add(string key)
		{
			names.Add(key);
			columns[key] = new ArrayList(32);
		}

		internal StringCollection Names
		{
			get { return this.names; }
		}

		public int Count
		{
			get { return this.columns.Count; }
		}

		public ArrayList this[int index]
		{
			get { return this[this.names[index]]; }
		}

		public ArrayList this[string columnName]
		{
			get
			{
				ArrayList column = null;
				this.columns.TryGetValue(columnName, out column);
				return column;
			}
		}
    }
}
